import Mock from 'mockjs'
const nameList=[{id:1,name:'赵春',lid:0},{id:2,name:'marsblue',lid:0},{id:3,name:'王五',lid:0},{id:4,name:'赵四',lid:0},{id:5,name:'李二',lid:0},{id:6,name:'老炮',lid:0},{id:7,name:'二炮',lid:0},{id:8,name:'王二',lid:0},{id:9,name:'刘海',lid:0}]
const labList=[
  {id:1,name:'科学实验室',rid:1},
  {id:2,name:'生物实验室',rid:2},
  {id:3,name:'化学实验室',rid:2},
  {id:4,name:'计算机实验室',rid:2},
  {id:5,name:'物理实验室',rid:3},
  {id:6,name:'智能实验室',rid:3},
  {id:7,name:'经济实验室',rid:1},
  {id:8,name:'电子实验室',rid:1},
  {id:9,name:'核能实验室',rid:1},
  {id:10,name:'制药实验室',rid:2}
]
const materialList=[
  {id:1,
  materials:[
    {name:'智能锁',num:16},
    {name:'试纸',num:2000},
    {name:'一次性手套',num:500}]
  },
  {id:2,
  materials:[
    {name:'培养皿',num:550},
    {name:'试管',num:150},
    {name:'防护服',num:16},
    {name:'其他',num:22}
  ]
  },
  {id:3,
  materials:[
    {name:'培养皿',num:550},
    {name:'试管',num:150},
    {name:'防护服',num:16},
    {name:'其他',num:22}
  ]
  },
  {id:4,
  materials:[
    {name:'计算机',num:55},
    {name:'鼠标',num:150},
    {name:'键盘',num:160},
    {name:'其他',num:22}
  ]},
  {id:5,materials:[]},
  {id:6,materials:[]},
  {id:7,materials:[]},
  {id:8,materials:[]},
  {id:9,materials:[]},
  {id:10,materials:[]},
]
const recordList=[{id:1,name:'李四',material:materials,starttime:'2020:10,12,10:24',endstart:'2020:10,12,11:43',lid:0}]

  const record = Mock.mock({
    'items|30': [{
      'user|1':nameList,
      'lab|1':labList,
      'material|1':materialList ,
      starttime: '@datetime',
      endtime: '@datetime'
    }]
  })
  const smallrecord = Mock.mock({
    'items|5': [{
      'user|1':nameList,
      'lab|1':labList,
      'material|1':materialList ,
      starttime: '@datetime',
      endtime: '@datetime'
    }]
  })
  const labs = Mock.mock({
    items: labList
  })
  const materials = Mock.mock({
    items:materialList
  })
  export default [
    {
      url: '/vue-admin-template/record/list',
      type: 'get',
      response: config => {
        const items = record.items
        return {
          code: 20000,
          data: {
            total: items.length,
            items: items
          }
        }
      }
    },
    {
      url: '/vue-admin-template/lab/list',
      type: 'get',
      response: config => {
        const items = labs.items
        return {
          code: 20000,
          data: {
            total: items.length,
            items: items
          }
        }
      }
    },
    {
      url: '/vue-admin-template/material/list',
      type: 'get',
      response: config => {
        const items = materials.items
        return {
          code: 20000,
          data: {
            total: items.length,
            items: items
          }
        }
      }
    },
    {
      url: '/vue-admin-template/record/smalllist',
      type: 'get',
      response: config => {
        const items = smallrecord.items
        return {
          code: 20000,
          data: {
            total: items.length,
            items: items
          }
        }
      }
    }
  ]